home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / rawstat / RCS / rawrpc.c,v < prev    next >
Encoding:
Text File  |  1990-11-30  |  15.1 KB  |  634 lines

  1. head     1.6;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.6
  10. date     90.11.29.23.09.19;  author kupfer;  state Exp;
  11. branches ;
  12. next     1.5;
  13.  
  14. 1.5
  15. date     90.07.26.12.07.51;  author douglis;  state Exp;
  16. branches ;
  17. next     1.4;
  18.  
  19. 1.4
  20. date     90.02.04.20.51.27;  author brent;  state Exp;
  21. branches ;
  22. next     1.3;
  23.  
  24. 1.3
  25. date     89.06.29.15.33.45;  author brent;  state Exp;
  26. branches ;
  27. next     1.2;
  28.  
  29. 1.2
  30. date     89.06.23.16.47.57;  author brent;  state Exp;
  31. branches ;
  32. next     1.1;
  33.  
  34. 1.1
  35. date     89.06.23.15.50.47;  author brent;  state Exp;
  36. branches ;
  37. next     ;
  38.  
  39.  
  40. desc
  41. @Raw printing of RPC statistics
  42. @
  43.  
  44.  
  45. 1.6
  46. log
  47. @Track the nack stats in Rpc_SrvStat.
  48. @
  49. text
  50. @/* 
  51.  * rawrpc.c --
  52.  *
  53.  *    Print raw format RPC statistics.
  54.  *
  55.  * Copyright (C) 1986 Regents of the University of California
  56.  * All rights reserved.
  57.  */
  58.  
  59. #ifndef lint
  60. static char rcsid[] = "$Header: /sprite/src/cmds/rawstat/RCS/rawrpc.c,v 1.5 90/07/26 12:07:51 douglis Exp Locker: kupfer $ SPRITE (Berkeley)";
  61. #endif not lint
  62.  
  63. #include <sprite.h>
  64. #include <stdio.h>
  65. #include <sysStats.h>
  66. #include <option.h>
  67. #include <kernel/sched.h>
  68. #include <vmStat.h>
  69. #include <host.h>
  70. #include <kernel/sync.h>
  71. #include <kernel/timer.h>
  72. #include <kernel/rpcClient.h>
  73. #include <kernel/rpcServer.h>
  74. #include <kernel/rpcCltStat.h>
  75. #include <kernel/rpcSrvStat.h>
  76. #include <kernel/rpcTrace.h>
  77. #include <kernel/rpcCall.h>
  78.  
  79. static ReturnStatus status;
  80. extern int zero;
  81.  
  82. /*
  83.  *----------------------------------------------------------------------
  84.  *
  85.  * PrintRawRpcCltStat --
  86.  *
  87.  *    Prints out the low-level statistics for the client side
  88.  *    of the RPC system.
  89.  *
  90.  * Results:
  91.  *    None.
  92.  *
  93.  * Side effects:
  94.  *    None.
  95.  *
  96.  *----------------------------------------------------------------------
  97.  */
  98.  
  99. PrintRawRpcCltStat()
  100. {
  101.     Rpc_CltStat rpcCltStat;
  102.     Rpc_CltStat *X = &rpcCltStat;
  103.  
  104.     status = Sys_Stats(SYS_RPC_CLT_STATS, TRUE, &rpcCltStat);
  105.     if (status != SUCCESS) {
  106.     return;
  107.     }
  108.     printf("Rpc_CltStat\n");
  109.     ZeroPrint("toClient       %8u\n", X->toClient);
  110.     ZeroPrint("badChannel     %8u\n", X->badChannel);
  111.     ZeroPrint("chanBusy       %8u\n", X->chanBusy);
  112.     ZeroPrint("badId          %8u\n", X->badId);
  113.     ZeroPrint("requests       %8u\n", X->requests);
  114.     ZeroPrint("replies        %8u\n", X->replies);
  115.     ZeroPrint("acks           %8u\n", X->acks);
  116.     ZeroPrint("recvPartial    %8u\n", X->recvPartial);
  117.     ZeroPrint("timeouts       %8u\n", X->timeouts);
  118.     ZeroPrint("aborts         %8u\n", X->aborts);
  119.     ZeroPrint("resends        %8u\n", X->resends);
  120.     ZeroPrint("sentPartial    %8u\n", X->sentPartial);
  121.     ZeroPrint("errors         %8u\n", X->errors);
  122.     ZeroPrint("nullErrors     %8u\n", X->nullErrors);
  123.     ZeroPrint("dupFrag        %8u\n", X->dupFrag);
  124.     ZeroPrint("close          %8u\n", X->close);
  125.     ZeroPrint("oldInputs      %8u\n", X->oldInputs);
  126.     ZeroPrint("badInput       %8u\n", X->badInput);
  127.     ZeroPrint("tooManyAcks    %8u\n", X->tooManyAcks);
  128.     ZeroPrint("chanWaits      %8u\n", X->chanWaits);
  129.     ZeroPrint("chanBroads     %8u\n", X->chanBroads);
  130.     ZeroPrint("chanHits       %8u\n", X->chanHits);
  131.     ZeroPrint("chanNew        %8u\n", X->chanNew);
  132.     ZeroPrint("chanReuse      %8u\n", X->chanReuse);
  133.     ZeroPrint("paramOverrun   %8u\n", X->paramOverrun);
  134.     ZeroPrint("dataOverrun    %8u\n", X->dataOverrun);
  135.     ZeroPrint("shorts         %8u\n", X->shorts);
  136.     ZeroPrint("longs          %8u\n", X->longs);
  137. }
  138.  
  139. /*
  140.  *----------------------------------------------------------------------
  141.  *
  142.  * PrintRawRpcSrvStat --
  143.  *
  144.  *    Prints out the low-level statistics for the service side
  145.  *    of the RPC system.
  146.  *
  147.  * Results:
  148.  *    None.
  149.  *
  150.  * Side effects:
  151.  *    None.
  152.  *
  153.  *----------------------------------------------------------------------
  154.  */
  155.  
  156. PrintRawRpcSrvStat()
  157. {
  158.     Rpc_SrvStat rpcSrvStat;
  159.     Rpc_SrvStat *X = &rpcSrvStat;
  160.  
  161.     status = Sys_Stats(SYS_RPC_SRV_STATS, TRUE, &rpcSrvStat);
  162.     if (status != SUCCESS) {
  163.     return;
  164.     }
  165.     printf("Rpc_SrvStat\n");
  166.     ZeroPrint("toServer       %8u\n", X->toServer);
  167.     ZeroPrint("noAlloc        %8u\n", X->noAlloc);
  168.     ZeroPrint("nacks          %8u\n", X->nacks);
  169.     ZeroPrint("invClient      %8u\n", X->invClient);
  170.     ZeroPrint("serverBusy     %8u\n", X->serverBusy);
  171.     ZeroPrint("requests       %8u\n", X->requests);
  172.     ZeroPrint("impAcks        %8u\n", X->impAcks);
  173.     ZeroPrint("handoffs       %8u\n", X->handoffs);
  174.     ZeroPrint("fragMsgs       %8u\n", X->fragMsgs);
  175.     ZeroPrint("handoffAcks    %8u\n", X->handoffAcks);
  176.     ZeroPrint("fragAcks       %8u\n", X->fragAcks);
  177.     ZeroPrint("sentPartial    %8u\n", X->sentPartial);
  178.     ZeroPrint("busyAcks       %8u\n", X->busyAcks);
  179.     ZeroPrint("resends        %8u\n", X->resends);
  180.     ZeroPrint("badState       %8u\n", X->badState);
  181.     ZeroPrint("extra          %8u\n", X->extra);
  182.     ZeroPrint("reclaims       %8u\n", X->reclaims);
  183.     ZeroPrint("reassembly     %8u\n", X->reassembly);
  184.     ZeroPrint("dupFrag        %8u\n", X->dupFrag);
  185.     ZeroPrint("nonFrag        %8u\n", X->nonFrag);
  186.     ZeroPrint("fragAborts     %8u\n", X->fragAborts);
  187.     ZeroPrint("recvPartial    %8u\n", X->recvPartial);
  188.     ZeroPrint("closeAcks      %8u\n", X->closeAcks);
  189.     ZeroPrint("discards       %8u\n", X->discards);
  190.     ZeroPrint("unknownAcks    %8u\n", X->unknownAcks);
  191.     ZeroPrint("mostNackBufs   %8u\n", X->mostNackBuffers);
  192.     ZeroPrint("selfNacks      %8u\n", X->selfNacks);
  193. }
  194.  
  195. /*
  196.  *----------------------------------------------------------------------
  197.  *
  198.  * PrintSrvCount --
  199.  *
  200.  *    Prints out the number of RPC calls made to this (server) host
  201.  *
  202.  * Results:
  203.  *    None.
  204.  *
  205.  * Side effects:
  206.  *    None.
  207.  *
  208.  *----------------------------------------------------------------------
  209.  */
  210.  
  211. PrintSrvCount()
  212. {
  213.     ReturnStatus status = SUCCESS;
  214.     register int call;
  215.     int rpcServiceCount[RPC_LAST_COMMAND+1];
  216.  
  217.     status = Sys_Stats(SYS_RPC_SRV_COUNTS, sizeof(rpcServiceCount),
  218.                     (Address)rpcServiceCount);
  219.     if (status != SUCCESS) {
  220.     return;
  221.     }
  222.  
  223.     printf("Rpc Service Calls\n");
  224.     for (call=0 ; call<=RPC_LAST_COMMAND ; call++) {
  225.     if (zero || rpcServiceCount[call] > 0) {
  226.         PrintCommand(stdout, call, "%-15s");
  227.         printf("%8u\n", rpcServiceCount[call]);
  228.     }
  229.     }
  230. }
  231.  
  232. /*
  233.  *----------------------------------------------------------------------
  234.  *
  235.  * PrintCallCount --
  236.  *
  237.  *    Prints out the number of RPC calls made by this (client) host
  238.  *
  239.  * Results:
  240.  *    None.
  241.  *
  242.  * Side effects:
  243.  *    None.
  244.  *
  245.  *----------------------------------------------------------------------
  246.  */
  247.  
  248. PrintCallCount()
  249. {
  250.     ReturnStatus status = SUCCESS;
  251.     register int call;
  252.     int rpcClientCalls[RPC_LAST_COMMAND+1];
  253.  
  254.     status = Sys_Stats(SYS_RPC_CALL_COUNTS, sizeof(rpcClientCalls),
  255.                     (Address)rpcClientCalls);
  256.     if (status != SUCCESS) {
  257.     return;
  258.     }
  259.  
  260.     printf("Rpc Client Calls\n");
  261.     for (call=0 ; call<=RPC_LAST_COMMAND ; call++) {
  262.     if (zero || rpcClientCalls[call] > 0) {
  263.         PrintCommand(stdout, call, "%-15s");
  264.         printf("%8u\n", rpcClientCalls[call]);
  265.     }
  266.     }
  267. }
  268.  
  269. /*
  270.  *----------------------------------------------------------------------
  271.  *
  272.  * PrintHostName --
  273.  *
  274.  *    Prints out the host name and trims of the internet domain suffix.
  275.  *
  276.  * Results:
  277.  *    None.
  278.  *
  279.  * Side effects:
  280.  *    None.
  281.  *
  282.  *----------------------------------------------------------------------
  283.  */
  284.  
  285. PrintHostName(spriteID, format)
  286.     int spriteID;
  287.     char *format;
  288. {
  289.     Host_Entry *entryPtr;
  290.     char string[64];
  291.     char *cPtr;
  292.  
  293.     entryPtr = Host_ByID(spriteID);
  294.     if (entryPtr == (Host_Entry *)NULL) {
  295.     sprintf(string, "%d", spriteID);
  296.     ZeroPrint(format, string);
  297.     } else {
  298.     for (cPtr = entryPtr->name ; *cPtr ; cPtr++) {
  299.         /*
  300.          * Strip off the domain suffix.
  301.          */
  302.         if (*cPtr == '.') {
  303.         *cPtr = '\0';
  304.         break;
  305.         }
  306.     }
  307.     ZeroPrint(format, entryPtr->name);
  308.     }
  309. }
  310.  
  311. /*
  312.  * PrintCommand --
  313.  *
  314.  *    Convert from procedure ID to procedure name and output it.
  315.  */
  316. PrintCommand(stream, command, format)
  317.     FILE *stream;
  318.     int command;
  319.     char *format;
  320. {
  321.     char buffer[128];
  322.     char *string;
  323.  
  324.     switch (command) {
  325.     case RPC_ECHO_1:
  326.         string = "echoIntr";
  327.         break;
  328.     case RPC_ECHO_2:
  329.         string = "echo";
  330.         break;
  331.     case RPC_SEND:
  332.         string = "send";
  333.         break;
  334.     case RPC_RECEIVE:
  335.         string = "recv";
  336.         break;
  337.     case RPC_GETTIME:
  338.         string = "get_time";
  339.         break;
  340.     case RPC_FS_PREFIX:
  341.         string = "prefix";
  342.         break;
  343.     case RPC_FS_OPEN:
  344.         string = "open";
  345.         break;
  346.     case RPC_FS_READ:
  347.         string = "read";
  348.         break;
  349.     case RPC_FS_WRITE:
  350.         string = "write";
  351.         break;
  352.     case RPC_FS_CLOSE:
  353.         string = "close";
  354.         break;
  355.     case RPC_FS_UNLINK:
  356.         string = "remove";
  357.         break;
  358.     case RPC_FS_RENAME:
  359.         string = "rename";
  360.         break;
  361.     case RPC_FS_MKDIR:
  362.         string = "mkdir";
  363.         break;
  364.     case RPC_FS_RMDIR:
  365.         string = "rmdir";
  366.         break;
  367.     case RPC_FS_MKDEV:
  368.         string = "make_dev";
  369.         break;
  370.     case RPC_FS_LINK:
  371.         string = "link";
  372.         break;
  373.     case RPC_FS_SYM_LINK:
  374.         string = "link";
  375.         break;
  376.     case RPC_FS_GET_ATTR:
  377.         string = "get_attrID";
  378.         break;
  379.     case RPC_FS_SET_ATTR:
  380.         string = "set_attrID";
  381.         break;
  382.     case RPC_FS_GET_ATTR_PATH:
  383.         string = "get_attr";
  384.         break;
  385.     case RPC_FS_SET_ATTR_PATH:
  386.         string = "set_attr";
  387.         break;
  388.     case RPC_FS_GET_IO_ATTR:
  389.         string = "getI/Oattr";
  390.         break;
  391.     case RPC_FS_SET_IO_ATTR:
  392.         string = "setI/Oattr";
  393.         break;
  394.     case RPC_FS_DEV_OPEN:
  395.         string = "dev_open";
  396.         break;
  397.     case RPC_FS_SELECT:
  398.         string = "select";
  399.         break;
  400.     case RPC_FS_IO_CONTROL:
  401.         string = "ioctl";
  402.         break;
  403.     case RPC_FS_CONSIST:
  404.         string = "consist";
  405.         break;
  406.     case RPC_FS_CONSIST_REPLY:
  407.         string = "cnsst_rply";
  408.         break;
  409.     case RPC_FS_COPY_BLOCK:
  410.         string = "block_copy";
  411.         break;
  412.     case RPC_FS_MIGRATE:
  413.         string = "mig_file";
  414.         break;
  415.     case RPC_FS_RELEASE:
  416.     case RPC_FS_RELEASE_NEW:
  417.         string = "release";
  418.         break;
  419.     case RPC_FS_REOPEN:
  420.         string = "reopen";
  421.         break;
  422.     case RPC_FS_RECOVERY:
  423.         string = "recov";
  424.         break;
  425.     case RPC_FS_DOMAIN_INFO:
  426.         string = "domain_info";
  427.         break;
  428.     case RPC_PROC_MIG_COMMAND:
  429.         string = "mig_cmd";
  430.         break;
  431.     case RPC_PROC_REMOTE_CALL:
  432.         string = "mig_call";
  433.         break;
  434.     case RPC_PROC_REMOTE_WAIT:
  435.         string = "wait";
  436.         break;
  437.     case RPC_PROC_GETPCB:
  438.         string = "getpcb";
  439.         break;
  440.     case RPC_REMOTE_WAKEUP:
  441.         string = "wakeup";
  442.         break;
  443.     case RPC_SIG_SEND:
  444.         string = "signal";
  445.         break;
  446.     default: {
  447.         sprintf(buffer,"%d",command);
  448.         string = buffer;
  449.         break;
  450.     }
  451.     }
  452.     fprintf(stream, format, string);
  453. }
  454. @
  455.  
  456.  
  457. 1.5
  458. log
  459. @added RPC_FS_RELEASE_NEW
  460. @
  461. text
  462. @d11 1
  463. a11 1
  464. static char rcsid[] = "$Header: /sprite/src/cmds/rawstat/RCS/rawrpc.c,v 1.4 90/02/04 20:51:27 brent Exp Locker: douglis $ SPRITE (Berkeley)";
  465. d14 15
  466. a28 15
  467. #include "sprite.h"
  468. #include "stdio.h"
  469. #include "sysStats.h"
  470. #include "option.h"
  471. #include "kernel/sched.h"
  472. #include "vmStat.h"
  473. #include "host.h"
  474. #include "kernel/sync.h"
  475. #include "kernel/timer.h"
  476. #include "kernel/rpcClient.h"
  477. #include "kernel/rpcServer.h"
  478. #include "kernel/rpcCltStat.h"
  479. #include "kernel/rpcSrvStat.h"
  480. #include "kernel/rpcTrace.h"
  481. #include "kernel/rpcCall.h"
  482. d119 1
  483. d142 2
  484. @
  485.  
  486.  
  487. 1.4
  488. log
  489. @Fixed label for getpcb RPC (was "wait")
  490. @
  491. text
  492. @d11 1
  493. a11 1
  494. static char rcsid[] = "$Header: /a/newcmds/rawstat/RCS/rawrpc.c,v 1.3 89/06/29 15:33:45 brent Exp $ SPRITE (Berkeley)";
  495. d364 1
  496. @
  497.  
  498.  
  499. 1.3
  500. log
  501. @Fixed field labels so they have no embedded spaces
  502. @
  503. text
  504. @d11 1
  505. a11 1
  506. static char rcsid[] = "$Header: /a/newcmds/rawstat/RCS/rawrpc.c,v 1.2 89/06/23 16:47:57 brent Exp Locker: brent $ SPRITE (Berkeley)";
  507. d385 1
  508. a385 1
  509.         string = "wait";
  510. @
  511.  
  512.  
  513. 1.2
  514. log
  515. @Chagned to unsigned print format to handle large numbers
  516. @
  517. text
  518. @d11 1
  519. a11 1
  520. static char rcsid[] = "$Header: /a/newcmds/rawstat/RCS/rawrpc.c,v 1.1 89/06/23 15:50:47 brent Exp Locker: brent $ SPRITE (Berkeley)";
  521. d286 1
  522. a286 1
  523.         string = "get time";
  524. d316 1
  525. a316 1
  526.         string = "make dev";
  527. d325 1
  528. a325 1
  529.         string = "get attrID";
  530. d328 1
  531. a328 1
  532.         string = "set attrID";
  533. d331 1
  534. a331 1
  535.         string = "get attr";
  536. d334 1
  537. a334 1
  538.         string = "set attr";
  539. d343 1
  540. a343 1
  541.         string = "dev open";
  542. d355 1
  543. a355 1
  544.         string = "cnsst rply";
  545. d358 1
  546. a358 1
  547.         string = "block copy";
  548. d361 1
  549. a361 1
  550.         string = "mig file";
  551. d373 1
  552. a373 1
  553.         string = "domain info";
  554. d376 1
  555. a376 1
  556.         string = "mig cmd";
  557. d379 1
  558. a379 1
  559.         string = "mig call";
  560. @
  561.  
  562.  
  563. 1.1
  564. log
  565. @Initial revision
  566. @
  567. text
  568. @d11 1
  569. a11 1
  570. static char rcsid[] = "$Header: /a/newcmds/rpcstat/RCS/rpcstat.c,v 1.16 89/06/23 13:41:16 brent Exp $ SPRITE (Berkeley)";
  571. d60 28
  572. a87 28
  573.     ZeroPrint("toClient       %8d\n", X->toClient);
  574.     ZeroPrint("badChannel     %8d\n", X->badChannel);
  575.     ZeroPrint("chanBusy       %8d\n", X->chanBusy);
  576.     ZeroPrint("badId          %8d\n", X->badId);
  577.     ZeroPrint("requests       %8d\n", X->requests);
  578.     ZeroPrint("replies        %8d\n", X->replies);
  579.     ZeroPrint("acks           %8d\n", X->acks);
  580.     ZeroPrint("recvPartial    %8d\n", X->recvPartial);
  581.     ZeroPrint("timeouts       %8d\n", X->timeouts);
  582.     ZeroPrint("aborts         %8d\n", X->aborts);
  583.     ZeroPrint("resends        %8d\n", X->resends);
  584.     ZeroPrint("sentPartial    %8d\n", X->sentPartial);
  585.     ZeroPrint("errors         %8d\n", X->errors);
  586.     ZeroPrint("nullErrors     %8d\n", X->nullErrors);
  587.     ZeroPrint("dupFrag        %8d\n", X->dupFrag);
  588.     ZeroPrint("close          %8d\n", X->close);
  589.     ZeroPrint("oldInputs      %8d\n", X->oldInputs);
  590.     ZeroPrint("badInput       %8d\n", X->badInput);
  591.     ZeroPrint("tooManyAcks    %8d\n", X->tooManyAcks);
  592.     ZeroPrint("chanWaits      %8d\n", X->chanWaits);
  593.     ZeroPrint("chanBroads     %8d\n", X->chanBroads);
  594.     ZeroPrint("chanHits       %8d\n", X->chanHits);
  595.     ZeroPrint("chanNew        %8d\n", X->chanNew);
  596.     ZeroPrint("chanReuse      %8d\n", X->chanReuse);
  597.     ZeroPrint("paramOverrun   %8d\n", X->paramOverrun);
  598.     ZeroPrint("dataOverrun    %8d\n", X->dataOverrun);
  599.     ZeroPrint("shorts         %8d\n", X->shorts);
  600.     ZeroPrint("longs          %8d\n", X->longs);
  601. d117 24
  602. a140 24
  603.     ZeroPrint("toServer       %8d\n", X->toServer);
  604.     ZeroPrint("noAlloc        %8d\n", X->noAlloc);
  605.     ZeroPrint("invClient      %8d\n", X->invClient);
  606.     ZeroPrint("serverBusy     %8d\n", X->serverBusy);
  607.     ZeroPrint("requests       %8d\n", X->requests);
  608.     ZeroPrint("impAcks        %8d\n", X->impAcks);
  609.     ZeroPrint("handoffs       %8d\n", X->handoffs);
  610.     ZeroPrint("fragMsgs       %8d\n", X->fragMsgs);
  611.     ZeroPrint("handoffAcks    %8d\n", X->handoffAcks);
  612.     ZeroPrint("fragAcks       %8d\n", X->fragAcks);
  613.     ZeroPrint("sentPartial    %8d\n", X->sentPartial);
  614.     ZeroPrint("busyAcks       %8d\n", X->busyAcks);
  615.     ZeroPrint("resends        %8d\n", X->resends);
  616.     ZeroPrint("badState       %8d\n", X->badState);
  617.     ZeroPrint("extra          %8d\n", X->extra);
  618.     ZeroPrint("reclaims       %8d\n", X->reclaims);
  619.     ZeroPrint("reassembly     %8d\n", X->reassembly);
  620.     ZeroPrint("dupFrag        %8d\n", X->dupFrag);
  621.     ZeroPrint("nonFrag        %8d\n", X->nonFrag);
  622.     ZeroPrint("fragAborts     %8d\n", X->fragAborts);
  623.     ZeroPrint("recvPartial    %8d\n", X->recvPartial);
  624.     ZeroPrint("closeAcks      %8d\n", X->closeAcks);
  625.     ZeroPrint("discards       %8d\n", X->discards);
  626.     ZeroPrint("unknownAcks    %8d\n", X->unknownAcks);
  627. d175 1
  628. a175 1
  629.         printf("%8d\n", rpcServiceCount[call]);
  630. d212 1
  631. a212 1
  632.         printf("%8d\n", rpcClientCalls[call]);
  633. @
  634.